var lengthOfLongestSubstring = function(s) {
  let left = 0
  let right = 1
  let str = s.slice(left, right)
  while(right <= s.length) {
      const temp = s.slice(left, right)
      // console.log(temp.slice(0,-1), temp[temp.length-1])
      if(temp.length>1 && temp.slice(0,-1).indexof(temp[temp.length-1])>-1 ){                
          left++
          continue
      }
      if(str.length< temp.length) {
        str = temp
      }
      right++
  }
  return str
};